package com.eamois.ui.util;

import java.awt.Component;

import javax.swing.ImageIcon;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;

import com.ufidaicon.icons.BrowserUfidaIcons;

public class CheckboxBomTreeRenderer extends DefaultTreeCellRenderer {
	public CheckboxBomTreeRenderer() {

	}

	public Component getTreeCellRendererComponent(JTree tree, Object value,
			boolean sel, boolean expanded, boolean leaf, int row,
			boolean hasFocus) {
		super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf,
				row, hasFocus);
		DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
//		if (node.isRoot()) {
//			setIcon(BrowserUfidaIcons.ICON_PRODUCT_SUPERBOM);
//		} else {
//			setIcon(BrowserUfidaIcons.ICON_PRODUCT_DESIGONBOM);
//		}
		if(node.getLevel()==0){
			setIcon(BrowserUfidaIcons.ICON_PRODUCT_SUPERBOM);
		}else if(node.getLevel()==1){
			setIcon(BrowserUfidaIcons.ICON_PRODUCT_DESIGONBOM);
		}else{
			setIcon(BrowserUfidaIcons.ICON_MATERIAL_ASSISTPART);
		}
		return this;
	}
}
